package css.sword.bean;


import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.io.Serializable;

public class ID implements Serializable {
    private long timeStamp;
    private long worker;
    private long sequence;

    public ID(long timeStamp, long worker, long sequence) {
        this.timeStamp = timeStamp;
        this.worker = worker;
        this.sequence = sequence;
    }

    public ID(){

    }

    public long getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(long timeStamp) {
        this.timeStamp = timeStamp;
    }

    public long getWorker() {
        return worker;
    }

    public void setWorker(long worker) {
        this.worker = worker;
    }

    public long getSequence() {
        return sequence;
    }

    public void setSequence(long sequence) {
        this.sequence = sequence;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        ID id = (ID) o;

        return new EqualsBuilder()
                .append(timeStamp, id.timeStamp)
                .append(worker, id.worker)
                .append(sequence, id.sequence)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(timeStamp)
                .append(worker)
                .append(sequence)
                .toHashCode();
    }

    @Override
    public String toString() {
        return "ID{" +
                "timeStamp=" + timeStamp +
                ", worker=" + worker +
                ", sequence=" + sequence +
                '}';
    }
}
